package book;

import java.util.ArrayList;
import java.util.List;

/**
 * 书架类——存放一本本的实体书籍
 */
public class BookList {
    //static  全员可见
    public static List<Book> books=new ArrayList<>();
    public static List<String> bookName=new ArrayList<>();

    //对两个链表进行初始化，静态变量的初始化可以使用静态代码块
    static{
        books.add(new Book("水浒传","施耐庵",66.6,"小说"));
        books.add(new Book("西游记","吴承恩",88.8,"小说"));
        books.add(new Book("红楼梦","曹雪芹",66.8,"小说"));
        books.add(new Book("三国演义","罗贯中",88.6,"小说"));

        bookName.add("水浒传");
        bookName.add("西游记");
        bookName.add("红楼梦");
        bookName.add("三国演义");
    }

    public void add(Book book) {
        books.add(book);
        bookName.add(book.getBookName());
    }
    public boolean contains(String booksName) {
        return BookList.bookName.contains(booksName);
    }

}
